package model;

import java.io.Serializable;
import javax.persistence.*;
import java.util.List;


/**
 * The persistent class for the cursus database table.
 * 
 */
@Entity
@NamedQuery(name="Cursus.findAll", query="SELECT c FROM Cursus c")
public class Cursus implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	private int idCursus;

	private int annee;

	private String etablissement;

	private String formation;

	private double moyenne;

	private String niveau;

	//bi-directional many-to-one association to Pay
	@ManyToOne
	@JoinColumn(name="idPays")
	private Pay pay;

	//bi-directional many-to-one association to Candidature
	@ManyToOne
	@JoinColumn(name="idCandidature")
	private Candidature candidature;

	//bi-directional many-to-one association to Ville
	@ManyToOne
	@JoinColumn(name="idVille")
	private Ville ville;

	//bi-directional many-to-one association to Document
	@OneToMany(mappedBy="cursus")
	private List<Document> documents;

	public Cursus() {
	}

	public int getIdCursus() {
		return this.idCursus;
	}

	public void setIdCursus(int idCursus) {
		this.idCursus = idCursus;
	}

	public int getAnnee() {
		return this.annee;
	}

	public void setAnnee(int annee) {
		this.annee = annee;
	}

	public String getEtablissement() {
		return this.etablissement;
	}

	public void setEtablissement(String etablissement) {
		this.etablissement = etablissement;
	}

	public String getFormation() {
		return this.formation;
	}

	public void setFormation(String formation) {
		this.formation = formation;
	}

	public double getMoyenne() {
		return this.moyenne;
	}

	public void setMoyenne(double moyenne) {
		this.moyenne = moyenne;
	}

	public String getNiveau() {
		return this.niveau;
	}

	public void setNiveau(String niveau) {
		this.niveau = niveau;
	}

	public Pay getPay() {
		return this.pay;
	}

	public void setPay(Pay pay) {
		this.pay = pay;
	}

	public Candidature getCandidature() {
		return this.candidature;
	}

	public void setCandidature(Candidature candidature) {
		this.candidature = candidature;
	}

	public Ville getVille() {
		return this.ville;
	}

	public void setVille(Ville ville) {
		this.ville = ville;
	}

	public List<Document> getDocuments() {
		return this.documents;
	}

	public void setDocuments(List<Document> documents) {
		this.documents = documents;
	}

	public Document addDocument(Document document) {
		getDocuments().add(document);
		document.setCursus(this);

		return document;
	}

	public Document removeDocument(Document document) {
		getDocuments().remove(document);
		document.setCursus(null);

		return document;
	}

}